The spontaneity of a reaction involves two concepts, enthalpy and entropy. Enthalpy is defined as the amount heat absorbed by a system at constant pressure. Entropy is a measure a the amount of disorder or randomness in a system. The relationship between reaction spontaneity, entropy and enthalpy is given by the Gibbs free energy function.
For a reaction occurring at constant temperature and pressure, is the change in enthalpy, T is the temperature in Kelvin and is the change in entropy.